Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support --gen-suppressions #4

Merged

Conversation

flavorjones
Copy link
Contributor

When valgrind is run with --gen-suppressions, it will write the
error's suppression to XML as something like:

    <suppression>
      <sname>insert_a_suppression_name_here</sname>
      <skind>Memcheck:Leak</skind>
      <skaux>match-leak-kinds: definite</skaux>
      <sframe> <fun>malloc</fun> </sframe>
      <sframe> <fun>objspace_xmalloc0</fun> </sframe>
      <sframe> <fun>ruby_xmalloc0</fun> </sframe>
      <sframe> <fun>ruby_xmalloc_body</fun> </sframe>
      <sframe> <fun>ruby_xmalloc</fun> </sframe>
    </suppression>

If this data is present, then ValgrindError will stream it in the
right format for copy-pasting into a suppressions file.

See https://wiki.wxwidgets.org/Valgrind_Suppression_File_Howto for more.

When valgrind is run with `--gen-suppressions`, it will write the
error's suppression to XML as something like:

    <suppression>
      <sname>insert_a_suppression_name_here</sname>
      <skind>Memcheck:Leak</skind>
      <skaux>match-leak-kinds: definite</skaux>
      <sframe> <fun>malloc</fun> </sframe>
      <sframe> <fun>objspace_xmalloc0</fun> </sframe>
      <sframe> <fun>ruby_xmalloc0</fun> </sframe>
      <sframe> <fun>ruby_xmalloc_body</fun> </sframe>
      <sframe> <fun>ruby_xmalloc</fun> </sframe>
    </suppression>

If this data is present, then ValgrindError will stream it in the
right format for copy-pasting into a suppressions file.

See https://wiki.wxwidgets.org/Valgrind_Suppression_File_Howto for more.
@peterzhu2118
Copy link
Member

peterzhu2118 commented Oct 21, 2021

👏 Wow! Amazing! This is something that I've wanted to do but haven't gotten around to yet.

@peterzhu2118 peterzhu2118 merged commit e04b259 into Shopify:master Oct 21, 2021
@flavorjones flavorjones deleted the flavorjones-generate-suppressions branch October 22, 2021 01:33
flavorjones added a commit to flavorjones/ruby_memcheck that referenced this pull request Dec 7, 2024
Valgrind 3.21.0 will exit if the fd limit is too high. This change is
described here:

> https://bugs.kde.org/show_bug.cgi?id=465435

A quote from a maintainer in that issue is: "We're not going to change
Valgrind to handle insane rlimits that Docker presents", however it
looks like Ubuntu 24.10 sets this limit very high:

    $ uname -a
    Linux bepi 6.11.0-1004-lowlatency Shopify#4-Ubuntu SMP PREEMPT_DYNAMIC Mon
    Sep 30 10:54:09 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
    $ ulimit -n
    1073741816

I suspect this patch will not work on some systems for a variety of
reasons, but I wanted to start a conversation about how to address
this issue.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants